package com.lh.controller;

import com.alibaba.fastjson.JSONObject;
import com.lh.entity.table.RectificationInfo;
import com.lh.entity.table.RectificationInfoApproval;
import com.lh.service.RectificationInfoApprovalService;
import com.lh.utils.Answer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/RectificationInfoApproval")
public class RectificationInfoApprovalController
{

    @Autowired
    private RectificationInfoApprovalService rectificationInfoApprovalService;

    @RequestMapping("/commitApproval")
    public Answer<Object> commitApproval(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.commitApproval(rectificationInfoApproval);
    }

    /**
     * 申请修改项目
     * @param rectificationInfoApproval
     * @return
     */
    @RequestMapping("/approval")
    public Answer<Object> approval(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.approval(rectificationInfoApproval);
    }

    @RequestMapping("/passApproval")
    public Answer<Object> passApproval(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.passApproval(reqJson);
    }

    @RequestMapping("/getWaitApproval")
    public Answer<Object> getWaitApproval(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.getWaitApproval(reqJson);
    }

    @RequestMapping("/getWaitApprovalCount")
    public Answer<Object> getWaitApprovalCount(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.getWaitApproval(reqJson);
    }
    @RequestMapping("/getRectificationInfoApprovalList")
    public Answer<Object> getRectificationInfoApprovalList(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.getRectificationInfoApprovalList(reqJson);
    }

    @RequestMapping("/deleteApproval")
    public Answer<Object> deleteApproval(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.deleteApproval(rectificationInfoApproval.getId());
    }


    @RequestMapping("/queryDeadlineNodeApprovalList")
    public Answer<Object> queryDeadlineNodeApprovalList(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.queryDeadlineNodeApprovalList(rectificationInfoApproval);
    }

    @RequestMapping("/queryTicketProblemApprovalList")
    public Answer<Object> queryTicketProblemApprovalList(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.queryTicketProblemApprovalList(rectificationInfoApproval);
    }

    @RequestMapping("/accountTermination")
    public Answer<Object> accountTermination(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.accountTermination(rectificationInfoApproval);
    }

    @RequestMapping("/exit")
    public Answer<Object> exit(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.exit(rectificationInfoApproval);
    }

    @RequestMapping("/passAccountTermination")
    public Answer<Object> passAccountTermination(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.passAccountTermination(reqJson);
    }

    @RequestMapping("/approvalExit")
    public Answer<Object> approvalExit(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.approvalExit(reqJson);
    }

    @RequestMapping("/updateDeadlineNodeApproval")
    public Answer<Object> updateDeadlineNodeApproval(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.updateDeadlineNodeApproval(reqJson);
    }

    @RequestMapping("/passDeadlineNodeApproval")
    public Answer<Object> passDeadlineNodeApproval(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.passDeadlineNodeApproval(reqJson);
    }

    @RequestMapping("/add")
    public Answer<Object> add(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.add(rectificationInfoApproval);
    }

    @RequestMapping("/groupNodeDepartmentType")
    public Answer<Object> groupNodeDepartmentType(@RequestBody JSONObject reqJson) {
        return rectificationInfoApprovalService.groupNodeDepartmentType(reqJson);
    }

    @RequestMapping("/updateApproval")
    public Answer<Object> updateApproval(@RequestBody RectificationInfoApproval rectificationInfoApproval) {
        return rectificationInfoApprovalService.updateApproval(rectificationInfoApproval);
    }

    @RequestMapping("/groupByTitle")
    public Answer<Object> groupByTitle() {
        return rectificationInfoApprovalService.groupByTitle();
    }
}
